/**
 * @param {string} s
 * @return {boolean}
 */
 var areOccurrencesEqual = function(s) {
    const map = new Map()
    for(let ch of s){
        map.set(ch, map.has(ch) ? map.get(ch)+1 : 1)
    }
    const arr = [...map.values()]
    for(let i = 1, n = arr.length; i<n; i++){
        if(arr[i] !== arr[i-1]){
            return false
        }
    }
    return true
};